import { pubRequire } from '@utils/public'
const baseUrl = '/activities/introduces'
/*活动列表*/
export function getAdviserList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callbBack, errBack)
}

// 删除鲜花活动
export function delActive(obj, callbBack, errBack) {
  return pubRequire(
    'delete',
    `${baseUrl}/${obj.activityId}`,
    obj,
    callbBack,
    errBack
  )
}

// 开始活动
export function startActive(activityId, callbBack, errBack) {
  return pubRequire(
    'patch',
    `${baseUrl}/${activityId}/start`,
    {},
    callbBack,
    errBack
  )
}

// 结束活动
export function endActive(activityId, callbBack, errBack) {
  return pubRequire(
    'patch',
    `${baseUrl}/${activityId}/end`,
    {},
    callbBack,
    errBack
  )
}

// 根据id查询活动详情
export function getActiveDetail(id, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/${id}`, '', callbBack, errBack)
}

//获取一级渠道
export function getIntroduceChannelList(callbBack, errBack) {
  return pubRequire(
    'get',
    '/activities/posters-introductions/introduce-channel',
    '',
    callbBack,
    errBack
  )
}
//二级渠道校验
export function getChannelverification(params, callbBack, errBack) {
  return pubRequire(
    'get',
    `/activities/posters-introductions/exists-introduce-channel/${params.channelCode}/${params.secondChannelName}`,
    '',
    callbBack,
    errBack
  )
}

// 新增转介绍活动
export function addActive(obj, callbBack, errBack) {
  return pubRequire('post', `${baseUrl}`, obj, callbBack, errBack)
}
// 修改转介绍活动
export function changeActive(id, obj, sucBack, errBack) {
  pubRequire('put', `/activities/introduces/${id}`, obj, sucBack, errBack)
}

// 转介绍活动验证活动名称是否重复
export function getAalidationName(name, callbBack, errBack) {
  return pubRequire(
    'get',
    `/activities/introduces/validation/name-existence?name=${name}`,
    '',
    callbBack,
    errBack
  )
}
//海报转介绍活动列表
export function getPostActiveList(params, callbBack, errBack) {
  return pubRequire(
    'get',
    `/activities/posters-introductions`,
    params,
    callbBack,
    errBack
  )
}

// 海报转介绍验证名称是否存在
export function getPostersName(name, callbBack, errBack) {
  return pubRequire(
    'get',
    `/activities/posters-introductions/validation/name-existence?name=${name}`,
    '',
    callbBack,
    errBack
  )
}
//海报转介绍新增
export function startPoster(id, callbBack, errBack) {
  return pubRequire(
    'patch',
    `/activities/posters-introductions/${id}/start`,
    '',
    callbBack,
    errBack
  )
}
//海报转介绍删除
export function deletePoster(id, callbBack, errBack) {
  return pubRequire(
    'delete',
    `/activities/posters-introductions/${id}`,
    '',
    callbBack,
    errBack
  )
}
// 海报转介绍展翅入量渠道
export function getPostersChannels(callbBack, errBack) {
  return pubRequire(
    'get',
    `/activities/posters-introductions/channels?code=zjshb`,
    '',
    callbBack,
    errBack
  )
}

//海报转介绍结束
export function endPoster(id, callbBack, errBack) {
  return pubRequire(
    'patch',
    `/activities/posters-introductions/${id}/end`,
    '',
    callbBack,
    errBack
  )
}
// 新增转介绍活动
export function addPoster(obj, callbBack, errBack) {
  return pubRequire(
    'post',
    `/activities/posters-introductions`,
    obj,
    callbBack,
    errBack
  )
}
// 修改转介绍活动
export function changePoster(id, obj, sucBack, errBack) {
  return pubRequire('put', `/activities/posters-introductions/${id}`, obj, sucBack, errBack)
}
// 根据id查询活动详情
export function getPosterDetail(id, callbBack, errBack) {
  return pubRequire('get', `/activities/posters-introductions/${id}`, '', callbBack, errBack)
}
